package com.yami.shop.platform.controller;

import com.yami.shop.common.bean.PageDTO;
import com.yami.shop.common.bean.PageVO;
import com.yami.shop.common.response.ServerResponseEntity;
import com.yami.shop.nft.common.model.NftDaw;
import com.yami.shop.nft.common.service.NftDawService;
import com.yami.shop.nft.common.vo.NftVO;
import com.yami.shop.platform.task.MintsNftDawTask;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController("platformNftDawController")
@RequestMapping("/admin/nftdaw")
@Tag(name = "admin-链上铸币信息")
public class NftDawController {

    @Autowired
    private NftDawService nftDawService;

    @Autowired
    private MintsNftDawTask mintsNftDawTask;

    @GetMapping("/getpageDaw")
    @Operation(summary =  "分页获取链上铸币信息", description = "分页获取链上铸币信息")
    public ServerResponseEntity<PageVO<NftVO>> getpageDaw(PageDTO pageDTO, @Param("nftName")String nftName, @Param("denomId")String denomId) {
        Integer sysType = 2;
        return ServerResponseEntity.success(nftDawService.pageNftDaw(pageDTO,nftName,denomId,sysType,null));
    }

    @GetMapping("/mintsNftDawNew")
    @Operation(summary =  "开始铸币", description = "开始铸币")
        public ServerResponseEntity MintsNftDawNew(@Param("applyId")Integer applyId) {
        nftDawService.MintsNftDawNew(applyId);
        return ServerResponseEntity.success();
    }

    @GetMapping("/addToMintsNftDawNew")
    @Operation(summary =  "追加铸币", description = "追加铸币")
    public ServerResponseEntity addToMintsNftDawNew(@Param("applyId")Integer applyId) {
        nftDawService.addToMintsNftDawNew(applyId);
        return ServerResponseEntity.success();
    }

    @GetMapping("/mintNftTask")
    @Operation(summary =  "测试铸币定时任务", description = "测试铸币定时任务")
    public ServerResponseEntity mintNftTask() {
        mintsNftDawTask.mintNftTask();
        return ServerResponseEntity.success();
    }

    @GetMapping("/txNftTask")
    @Operation(summary =  "测试", description = "测试")
    public ServerResponseEntity txNftTask() {
        mintsNftDawTask.txNftTask();
        return ServerResponseEntity.success();
    }
    @GetMapping("/txDenomNftTask")
    @Operation(summary =  "测试", description = "测试")
    public ServerResponseEntity txDenomNftTask() {
        mintsNftDawTask.txDenomNftTask();
        return ServerResponseEntity.success();
    }

}
